#ifndef CAMERAHANDLER_H
#define CAMERAHANDLER_H

#include <QObject>
#include <QCamera>
#include <QCameraViewfinder>
#include <QCameraImageCapture>
#include <QVideoProbe>
#include <QVideoFrame>
#include <QImage>
#include <QAbstractVideoSurface>
#include <QByteArray>


class VideoSurface:public QAbstractVideoSurface
{
    Q_OBJECT
public:
    VideoSurface(QObject* parent=0);
    virtual QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const override;
    bool present(const QVideoFrame &frame) override;
signals:
    void videoChanged(QVideoFrame);
};



class cameraHandler : public QObject
{
    Q_OBJECT
public:
    explicit cameraHandler( QObject *parent = nullptr);

    void setImageQuality(int value);

private:
    QCamera *camera;
    int imageQuality = 0;

private slots:
    void onVideoChanged(QVideoFrame curframe);

signals:
    void videoUpdated(QImage& map);
    void sendVideo(QByteArray byte);
};

#endif // CAMERAHANDLER_H
